<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> 

<%@ Page Language="C#" MasterPageFile="~/_layouts/dialog.master"%> 

<%@ Import Namespace="Microsoft.SharePoint.WebControls" %> 
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register TagPrefix="wssuc" TagName="SchedulePicker" src="/_controltemplates/schedulepicker.ascx" %> 

<script runat="server">
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            
            if (!IsPostBack)
            {
                string value = Request.QueryString["Value"];
                if (!string.IsNullOrEmpty(value))
                    schedulePicker.ScheduleString = System.Web.HttpUtility.UrlDecode(value);
            }
        }
        
        protected override void OnInit(EventArgs e)
        {
            ((DialogMaster)this.Page.Master).OkButton.Click += new EventHandler(OkButton_Click);
        }        

        protected void OkButton_Click(object sender, EventArgs e)
        {
            ReturnAndClose();
        }
        private void ReturnAndClose()
        {
            // Allows the page to automaticly close
            Page.ClientScript.RegisterStartupScript(
                this.GetType(), 
                "OkAndClose", 
                string.Format("window.returnValue='{0}';doCancel();", schedulePicker.ScheduleString),
                true);
        }
</script>

<asp:Content contentplaceholderid="PlaceHolderDialogHeaderPageTitle" runat="server">
    Select a schedule
</asp:Content>

<asp:Content contentplaceholderid="PlaceHolderDialogDescription" runat="server">
    Select a schedule by selecting the appropriate properties.
</asp:Content>

<asp:Content contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server" >
	<SharePoint:ScriptLink ID="ScriptLink1" language="javascript" name="owsbrows.js" runat="server" /></script>
	<SharePoint:ScriptLink ID="ScriptLink2" language="javascript" name="core.js" runat="server" />
	<SharePoint:ScriptLink ID="ScriptLink3" language="javascript" name="AssetPickers.js" runat="server" />
	<SharePoint:CustomJSUrl ID="CustomJSUrl1" runat="server" />
	<SharePoint:CssRegistration ID="CssRegistration1" name="core.css" runat="server" />
	<SharePoint:CssRegistration ID="CssRegistration2" name="portal.css" runat="server" />
</asp:Content>

<asp:Content contentplaceholderid="PlaceHolderHelpLink" runat="server">
</asp:Content>

<asp:Content contentplaceholderid="PlaceHolderDialogBodyHeaderSection" runat="server">
</asp:Content>

<asp:Content contentplaceholderid="PlaceHolderDialogBodyMainSection" runat="server">
    <wssuc:SchedulePicker ID="schedulePicker" Enabled="True" Divider="True" Minutes="True" Daily="True" Weekly="true" Monthly="true" Hourly="True" runat="server" />
</asp:Content>

